package mka.puzzle.shape;

import java.awt.Graphics;
import java.util.ArrayList;

public class Triangle extends Shape {
	private Point pointOne;
	private Point pointTwo;
	private Point pointTree;

	private Line sideOne;
	private Line sideTwo;
	private Line sideThree;

	/***************************************************************
	 * Constrtuctor.
	 ***************************************************************/
	public Triangle(Point pointOne, Point pointTwo, Point pointTree) {
		super();
		this.pointOne = pointOne;
		this.pointTwo = pointTwo;
		this.pointTree = pointTree;
		this.sideOne = new Line(pointOne, pointTwo);
		this.sideTwo = new Line(pointTwo, pointTree);
		this.sideThree = new Line(pointOne, pointTree);
	}

	/***************************************************************
	 * Set & Get method.
	 ***************************************************************/
	public Point getPointOne() {
		return pointOne;
	}

	public void setPointOne(Point pointOne) {
		this.pointOne = pointOne;
	}

	public Point getPointTwo() {
		return pointTwo;
	}

	public void setPointTwo(Point pointTwo) {
		this.pointTwo = pointTwo;
	}

	public Point getPointTree() {
		return pointTree;
	}

	public void setPointTree(Point pointTree) {
		this.pointTree = pointTree;
	}

	public Line getSideOne() {
		return sideOne;
	}

	public void setSideOne(Line sideOne) {
		this.sideOne = sideOne;
	}

	public Line getSideTwo() {
		return sideTwo;
	}

	public void setSideTwo(Line sideTwo) {
		this.sideTwo = sideTwo;
	}

	public Line getSideThree() {
		return sideThree;
	}

	public void setSideThree(Line sideThree) {
		this.sideThree = sideThree;
	}

	/***************************************************************
	 * Override from superclass.
	 ***************************************************************/

	/**
	 * Get name of triangle.
	 * 
	 * @return String
	 */
	@Override
	public String getName() {
		return "Triangle";
	}

	@Override
	public double getPerimeter() {
		return this.sideOne.getPerimeter() + this.sideTwo.getPerimeter()
				+ this.sideThree.getPerimeter();
	}

	@Override
	public double getArea() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public ArrayList<Point> allPointBound() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ArrayList<Point> allPointShape() {
		// TODO Auto-generated method stub
		return null;
	}

	/***************************************************************
	 * Draw and paint method.
	 ***************************************************************/
	/***
	 * draw.
	 * 
	 * Draw the Triangle by java function
	 * 
	 * @param g
	 *            Graphics
	 */
	@Override
	public void draw(Graphics g) {
		g.drawLine((int) this.pointOne.getX(), (int) this.pointOne.getY(),
				(int) this.pointTwo.getX(), (int) this.pointTwo.getY());
		g.drawLine((int) this.pointTwo.getX(), (int) this.pointTwo.getY(),
				(int) this.pointTree.getX(), (int) this.pointTree.getY());
		g.drawLine((int) this.pointOne.getX(), (int) this.pointOne.getY(),
				(int) this.pointTree.getX(), (int) this.pointTree.getY());
	}
}
